
import { reactive,onUpdated,onMounted } from 'vue'
import axios from 'axios'

export default function () {
   
    const images = reactive([])


    async function getDog() {
        try {
            let res = await axios.get('https://dog.ceo/api/breed/pembroke/images/random')
            images.push(res.data.message)
        } catch (e) {
            alert(e)
        }
    }

    onMounted(()=>{
        console.log("2组件挂载了")
    })

    onUpdated(()=>{
        console.log("2组件更新了")
    })


    return {images,getDog}
}